using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Entities;
using Utility;
namespace BUS
{
   public class tbCTdiadanhamthucBUS
   {
       public static void Insert(tbChitietdiadanhamthuc ct)
       {
           tbChitietdiadanhamthucDAL ctDAL = new tbChitietdiadanhamthucDAL();
           ctDAL.Insert(ct);
       }
       public static void Update(tbChitietdiadanhamthuc ct)
       {
           tbChitietdiadanhamthucDAL ctDAL = new tbChitietdiadanhamthucDAL();
           ctDAL.Update(ct);
       }
       public static void Delete(int iD)
       {
           tbChitietdiadanhamthucDAL ctDAL = new tbChitietdiadanhamthucDAL();
           ctDAL.Delete(iD);
       }
       public static tbCTdiadanhamthucCollection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
       {
           tbChitietdiadanhamthucDAL ctDAL = new tbChitietdiadanhamthucDAL();
           return ctDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
       }
       public static tbCTdiadanhamthucCollection GetAll()
       {
           int total = 0;
           Criteria cri = new Criteria();
           tbChitietdiadanhamthucDAL ctDAL = new tbChitietdiadanhamthucDAL();
           return ctDAL.Get(cri.Criter, 0, 0, tbCTdiadanhamthucCOllumn.mactdiadanhamthuc.ToString(), OrderDirection.ASC.ToString(), out total);
       }
       public static tbChitietdiadanhamthuc GetByID(int iD)
       {
           int total = 0;
           Criteria cri = new Criteria();
           cri.add(Condition.AND, tbCTdiadanhamthucCOllumn.mactdiadanhamthuc.ToString(), Condition.EQUAL, iD);
           tbChitietdiadanhamthucDAL ctDAL = new tbChitietdiadanhamthucDAL();
          tbCTdiadanhamthucCollection ctColl = ctDAL.Get(cri.Criter, 0, 0, tbCTdiadanhamthucCOllumn.mactdiadanhamthuc.ToString(), OrderDirection.ASC.ToString(), out total);
           if (ctColl.Count > 0)
               return ctColl[0];
           return null;
       }
       public static tbCTdiadanhamthucCollection GetLimited(int number)
       {
           int total = 0;
           Criteria cri = new Criteria();
           tbChitietdiadanhamthucDAL ctDAL = new tbChitietdiadanhamthucDAL();
           return ctDAL.Get(cri.Criter, 1, number,
            tbCTdiadanhamthucCOllumn.mactdiadanhamthuc.ToString(), OrderDirection.DESC.ToString(), out total);
       }
       public static tbCTdiadanhamthucCollection GetPromotion(int number)
       {
           int total = 0;
           Criteria cri = new Criteria();
           tbChitietdiadanhamthucDAL ctDAL = new tbChitietdiadanhamthucDAL();
           return ctDAL.Get(cri.Criter, 1, number,
              tbCTdiadanhamthucCOllumn.mactdiadanhamthuc.ToString(), OrderDirection.DESC.ToString(), out total);
       }
    }
}
